/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(function(){
    /*
     * Check is login
     * 
     */
    val_str_key = $.trim($("#member_key_authentication").attr("class"));
    var val_keys;
    if(val_str_key != null || val_str_key != ""){
        val_keys = val_str_key.split("_");
    }
    
    if(val_keys.length == 4){
        
        if($.trim(val_keys[3]) != "" || $.trim(val_keys[3]) != null || $.trim(val_keys[3]) != "0"){
            $("#member_key_authentication").empty().text("Logout");
        }
        if($.trim(val_keys[3]) == "0"){
            $("#member_key_authentication").empty().text("Login");
        }
    }
    $.fn.member_logout = function(){
        $("#member_key_authentication").click(function(){
            //confirm logout
            if(!confirm(logout_confirm)){
                return false;
            }
            $auth_url = $("#search_url").attr("value");
            window.location.href=$auth_url + "act=reportal&&CODE=member-logout";
            return false;
        });
    }
    
    $("#go_to_home").click(function(e){
        //console.log($("#search_url").attr("value"));return false;
        window.location.href=$("#search_url").attr("value") + "act=regportal&&CODE=redirect&&method=index";        
        return false; 
    });   
    
    $("#go_to_profile").click(function(e){
        window.location.href=$("#search_url").attr("value") + "act=regportal&&CODE=redirect&&method=profile"; 
        return false; 
    });
    $("#go_to_info").click(function(e){
           window.location.href=$("#search_url").attr("value") + "act=regportal&&CODE=redirect&&method=info"; 
           return false; 
    });
});


